import { useNavigate } from 'react-router-dom';
const removeItems = ['userInfo', 'access_token', 'refresh_token'];
export default function useBack() {
  const navagate = useNavigate();
  const back = () => {
    localStorage.removeItem('userInfo');
    removeItems.forEach(v => {
      localStorage.removeItem(v);
    });
    navagate('/login');
  };

  return { back };
}
